<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // length 可读可写
      var arr1 = [1, 2, 3, 4]
      console.log(arr1.length) // 4
      arr1.length = 3
      console.log(arr1) // [1,2,3] 只会从后面删
      arr1.length = 0 //清空数组
      console.log(arr1) // []

      // 索引 0,1,2...
      var arr2 = ['小曼', '米粒', '大大']
      console.log(arr2[1]) // 米粒

      // 遍历
      var arr3 = [3, 4, 2, 6, 7, 2, 9, 1, 0]
      for (var i = 0; i < arr.length; i++) {
        console.log(arr3[i])
      }
    </script>
  </body>
</html>
